<template>
  <div class="activities-container">
    <div class="btn-list">
      <div>
        <el-button type="primary">
          <svg-icon icon-class="staff-add"></svg-icon>
          新增項目
        </el-button>
        <el-button>
          <svg-icon icon-class="edit"></svg-icon>
          編輯活動
        </el-button>
        <el-button>
          <svg-icon icon-class="edit"></svg-icon>
          取消申請
        </el-button>
        <el-button>
          <svg-icon icon-class="export"></svg-icon>
          匯出數據
        </el-button>
      </div>
    </div>
    <div class="small-card-wrap">
      <small-card
        class="small-card"
        :title="item.title"
        :bg-color="item.bgColor"
        :end-val="item.endVal"
        :is-up="item.isUp"
        :percent-num="item.percentNum"
        :icon-class="item.iconClass"
        v-for="(item, index) in invoiceCardListData"
        :key="index"
      ></small-card>
    </div>
    <div class="project-detail-wrap br-20">
      <h4>項目資訊詳情</h4>
      <div class="project-detail-card">
        <div class="project-detail-card-item br-10">
          <div class="title">項目狀態</div>
          <div class="status">進行中</div>
          <el-progress :percentage="45" :stroke-width="11" color="#58CE93" :show-text="false"></el-progress>
          <div class="bottom">
            <span>完成度</span>
            <span>45%</span>
          </div>
        </div>
        <div class="project-detail-card-item br-10">
          <div class="title">負責人</div>
          <div class="avatar">
            <svg-icon icon-class="avatar-3"></svg-icon>
            <span>張三</span>
          </div>
          <div class="phone">
            <svg-icon icon-class="phone"></svg-icon>
            <span>138****1234</span>
          </div>
          <div class="email">
            <svg-icon icon-class="email-2"></svg-icon>
            <span>zhangsan@eaxple.com</span>
          </div>
        </div>
        <div class="project-detail-card-item br-10">
          <div class="title">時間安排</div>
          <div class="start-date">
            <svg-icon icon-class="end-date"></svg-icon>
            <span>開始時間2025-07-20</span>
          </div>
          <div class="end-date">
            <svg-icon icon-class="end-date"></svg-icon>
            <span>結束時間2025-07-20</span>
          </div>
          <div class="days">
            <svg-icon icon-class="days"></svg-icon>
            <span>剩餘時間：15天</span>
          </div>
        </div>
        <div class="project-detail-card-item br-10">
          <div class="title">預算情況</div>
          <div>
            <span>總預算：</span>
            <span>￥50000</span>
          </div>
          <div>
            <span>已使用：</span>
            <span>￥23000</span>
          </div>
          <div>
            <span>預算使用率</span>
            <span>46%</span>
          </div>
          <el-progress :percentage="46" :stroke-width="11" color="#F9B280" :show-text="false"></el-progress>
        </div>
      </div>
      <div class="tabs-wrap">
        <el-tabs v-model="activeName">
          <el-tab-pane label="基本資訊" name="first">基本資訊</el-tab-pane>
          <el-tab-pane label="流程日誌" name="second">流程日誌</el-tab-pane>
          <el-tab-pane label="預算明細" name="third">預算明細</el-tab-pane>
          <el-tab-pane label="參與人員" name="fourth">參與人員</el-tab-pane>
        </el-tabs>
      </div>
    </div>
    <div class="follow-person-wrap br-20">
      <h4>活動專案跟進人員</h4>
      <div class="follow-person">
        <div class="follow-person-left br-10">
          <div class="top">
            <h5>人員池</h5>
            <div>
              <el-input suffix-icon="el-icon-search" placeholder="搜尋人員"></el-input>
            </div>
          </div>
          <div class="list">
            <el-scrollbar style="height: 100%">
              <div class="list-item" v-for="item in 10" :key="item">
                <div class="left-item">
                  <svg-icon icon-class="awatar"></svg-icon>
                  <div class="info">
                    <div>張三</div>
                    <div>市場總監</div>
                  </div>
                </div>
                <div class="right-item">
                  <svg-icon icon-class="add-person"></svg-icon>
                </div>
              </div>
            </el-scrollbar>
          </div>
        </div>
        <div class="follow-person-right br-10">
          <div class="top">
            <h5>已分配人員</h5>
            <div>
              <el-select placeholder="全部角色">
                <el-option v-for="item in 4" :key="item" :label="item" :value="item"></el-option>
              </el-select>
              <el-button style="margin-left: 12px">
                <svg-icon icon-class="download"></svg-icon>
              </el-button>
            </div>
          </div>
          <div class="list">
            <el-scrollbar style="height: 100%">
              <div class="item-right" v-for="item in 10" :key="item">
                <div>
                  <div class="left-item">
                    <svg-icon icon-class="awatar"></svg-icon>
                    <div class="info">
                      <div>張三</div>
                      <div>市場總監</div>
                    </div>
                  </div>
                  <div class="right-item">
                    <el-switch v-model="value"></el-switch>
                  </div>
                </div>
                <div style="font-size: 14px; line-height: 20px; margin-bottom: 10px">職責說明：負責活動整體策劃、資源協調</div>
              </div>
            </el-scrollbar>
          </div>
        </div>
      </div>
    </div>
    <div class="activities-flow-wrap br-20">
      <h4>活動專案流程</h4>
      <div class="activities-flow">
        <div class="activities-flow-top">
          <div class="activities-flow-top-head">
            <div>流程模板</div>
            <div>
              <el-button type="text">新建模板</el-button>
            </div>
          </div>
          <div class="activities-flow-top-list">
            <div class="activities-flow-top-list-item br-10" :class="item === 1 ? 'active' : ''" v-for="item in 4" :key="item">
              <svg-icon icon-class="star"></svg-icon>
              <div class="info">
                <div class="txt-1">標準流程</div>
                <div class="txt-2">適用於大多數活動</div>
              </div>
            </div>
          </div>
        </div>
        <div class="activities-flow-content">
          <div class="activities-flow-content-left">
            <div class="card">
              <h5>進度跟蹤</h5>
              <div class="card-item br-10 left-1">
                <div>總體進度：45%</div>
                <el-progress :percentage="45" :stroke-width="13" color="#3C58FC" :show-text="false"></el-progress>
                <div class="small-card-list">
                  <div class="small-card-list-item" v-for="item in 4" :key="item">
                    <div>計劃開始日期</div>
                    <div>2025-07-15</div>
                  </div>
                </div>
              </div>
            </div>
            <div class="card">
              <h5>流程節點詳情</h5>
              <div class="card-item br-10 left-2">
                <div class="card-item-detail br-5">
                  <div class="head">
                    <div>
                      <i class="el-icon-success" style="color: #58ce93"></i>
                      <span>活動策劃</span>
                    </div>
                    <div class="status br-20 success">已完成</div>
                  </div>
                  <div class="info">
                    <div>負責人：張三</div>
                    <div>2025-07-21至2025-08-21</div>
                  </div>
                  <div class="progress">
                    <div>完成情況</div>
                    <div>100%</div>
                  </div>
                  <el-progress :percentage="100" :stroke-width="10" color="#58CE93" :show-text="false"></el-progress>
                  <div class="desc">活動方案已通過審批，預算已分配，資源已準備就緒</div>
                </div>
                <div class="card-item-detail br-5">
                  <div class="head">
                    <div>
                      <i class="el-icon-success" style="color: #58ce93"></i>
                      活動策劃
                    </div>
                    <div class="status success">已完成</div>
                  </div>
                  <div class="info">
                    <div>負責人：張三</div>
                    <div>2025-07-21至2025-08-21</div>
                  </div>
                  <div class="progress">
                    <div>完成情況</div>
                    <div>100%</div>
                  </div>
                  <el-progress :percentage="100" :stroke-width="10" color="#58CE93" :show-text="false"></el-progress>
                  <div class="desc">活動方案已通過審批，預算已分配，資源已準備就緒</div>
                </div>
              </div>
            </div>
          </div>
          <div class="activities-flow-content-right">
            <div class="card">
              <div class="top">
                <h5>當前流程設計</h5>
                <div>
                  <svg-icon icon-class="edit"></svg-icon>
                  <svg-icon icon-class="copy-2"></svg-icon>
                  <svg-icon icon-class="delete-2"></svg-icon>
                </div>
              </div>
              <div class="card-item br-10">
                <div class="list-item" v-for="item in 5" :key="item">
                  <div class="left">
                    <div :class="item === 1 || item === 2 ? 'success' : item === 3 ? 'warning' : ''">{{ item }}</div>
                    <div>
                      <div class="txt-1">活動策劃</div>
                      <div class="txt-2">完成活動方案的制定和審批</div>
                    </div>
                  </div>
                  <div class="right">
                    <div>
                      <i class="el-icon-user"></i>
                      <span>張三</span>
                    </div>
                    <div>
                      <i class="el-icon-time"></i>
                      <span>5個工作日</span>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import SmallCard from '@/components/SmallCard/index.vue'

export default {
  name: 'activities-management',
  components: { SmallCard },
  data() {
    return {
      activeName: 'first',
      invoiceCardListData: [
        { title: '進行中項目', endVal: 24, isUp: false, percentNum: 12, iconClass: 'activities-card-1' },
        { title: '已完成項目', endVal: 16, isUp: false, percentNum: 12, iconClass: 'activities-card-2' },
        { title: '待審批項目', endVal: 8, isUp: false, percentNum: 12, iconClass: 'activities-card-3' },
        { title: '已逾期項目', endVal: 24, isUp: true, percentNum: 12, iconClass: 'activities-card-4' }
      ]
    }
  }
}
</script>

<style scoped lang="less">
.activities-container {
  .btn-list {
    margin-bottom: 16px;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .small-card-wrap {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 20px;
    .small-card {
      margin-right: 15px;
      //min-width: 300px;
      flex: auto;
      &:last-child {
        margin-right: 0;
      }
    }
  }
  .project-detail-wrap {
    padding: 25px 30px;
    background: #fff;
    margin-bottom: 20px;
    h4 {
      font-size: 18px;
      line-height: 25px;
      margin: 0 0 21px 0;
    }
    .project-detail-card {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      align-items: center;
      margin-bottom: 40px;
      &-item {
        flex: auto;
        margin-right: 20px;
        background: rgba(60, 88, 252, 0.02);
        //min-width: 284px;
        height: 144px;
        padding: 10px 14px;
        .title {
          font-size: 14px;
          line-height: 20px;
          color: rgba(0, 0, 0, 0.5);
          margin-bottom: 8px;
        }
        &:nth-of-type(1) {
          .status {
            position: relative;
            font-size: 14px;
            line-height: 20px;
            color: rgba(0, 0, 0, 0.5);
            margin-bottom: 14px;
            margin-left: 12px;
            &:before {
              position: absolute;
              content: '';
              width: 8px;
              height: 8px;
              background: #58ce93;
              border-radius: 50%;
              top: 6px;
              left: -12px;
            }
          }
          .el-progress {
            margin-bottom: 10px;
          }
          .bottom {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            font-size: 14px;
            line-height: 20px;
          }
        }
        &:nth-of-type(2) {
          .avatar {
            display: flex;
            justify-content: flex-start;
            align-items: center;
            margin-bottom: 17px;
            .svg-icon {
              font-size: 30px;
              margin-right: 11px;
            }
            span {
              font-size: 14px;
              line-height: 20px;
            }
          }
          .phone,
          .email {
            display: flex;
            justify-content: flex-start;
            align-items: center;
            margin-bottom: 4px;
            .svg-icon {
              font-size: 16px;
              margin-right: 6px;
            }
            span {
              font-size: 14px;
              line-height: 20px;
              color: rgba(0, 0, 0, 0.7);
            }
          }
        }
        &:nth-of-type(3) {
          .start-date,
          .end-date,
          .days {
            display: flex;
            justify-content: flex-start;
            align-items: center;
            .svg-icon {
              font-size: 16px;
              margin-right: 12px;
            }
            span {
              font-size: 14px;
              line-height: 20px;
              color: rgba(0, 0, 0, 0.7);
            }
          }
          .end-date {
            margin: 9px 0 14px;
          }
          .days {
            font-size: 14px;
            line-height: 17px;
            span {
              color: #3c58fc;
            }
          }
        }
        &:nth-of-type(4) {
          > div {
            display: flex;
            justify-content: space-between;
            align-items: center;
            font-size: 14px;
            line-height: 20px;
            color: rgba(0, 0, 0, 0.7);
          }
          > div:nth-of-type(1) {
            margin-bottom: 8px;
          }
          > div:nth-of-type(2) {
            margin-bottom: 4px;
          }
          > div:nth-of-type(3) {
            margin-bottom: 4px;
          }
        }
        &:last-child {
          margin-right: 0;
        }
      }
    }
  }
  .follow-person-wrap {
    background: #fff;
    padding: 25px 30px;
    margin-bottom: 20px;
    h4 {
      margin: 0 0 35px 0;
    }
    .follow-person {
      display: flex;
      justify-content: space-between;
      flex-wrap: wrap;
      align-items: center;
      > div {
        //min-width: 582px;
        height: 392px;
        flex: auto;
        background: rgba(60, 88, 252, 0.02);
        padding: 19px 28px;
        margin-right: 22px;
        &:last-child {
          margin-right: 0;
        }
        .top {
          display: flex;
          justify-content: space-between;
          align-items: center;
          flex-wrap: wrap;
          margin-bottom: 16px;
          h5 {
            font-size: 16px;
            line-height: 22px;
            margin: 0;
          }
        }
      }
      &-left,
      &-right {
        .list {
          height: 304px;
          ::v-deep .el-scrollbar__wrap {
            overflow-x: hidden;
          }
          &-item {
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            align-items: center;
            .left-item {
              display: flex;
              justify-content: flex-start;
              flex-wrap: wrap;
              align-items: center;
              padding: 10px 0 17px;
              .svg-icon {
                font-size: 50px;
                margin-right: 20px;
              }
              .info {
                font-size: 14px;
                line-height: 20px;
                > div:first-child {
                  margin-bottom: 10px;
                }
              }
            }
            .right-item {
              .svg-icon {
                font-size: 40px;
                cursor: pointer;
              }
            }
          }
          .item-right {
            border-bottom: 1px solid rgba(0, 0, 0, 0.1);
            > div {
              display: flex;
              justify-content: space-between;
              flex-wrap: wrap;
              align-items: center;
            }
            .left-item {
              display: flex;
              justify-content: flex-start;
              flex-wrap: wrap;
              align-items: center;
              padding: 10px 0 17px;
              .svg-icon {
                font-size: 50px;
                margin-right: 20px;
              }
              .info {
                font-size: 14px;
                line-height: 20px;
                > div:first-child {
                  margin-bottom: 10px;
                }
              }
            }
            .right-item {
              .svg-icon {
                font-size: 40px;
                cursor: pointer;
              }
            }
          }
        }
      }
    }
  }
  .activities-flow-wrap {
    background: #fff;
    padding: 25px 30px;
    h4 {
      margin: 0 0 20px 0;
    }
    .activities-flow {
      &-top {
        margin-bottom: 17px;
        &-head {
          display: flex;
          justify-content: space-between;
          flex-wrap: wrap;
          align-content: center;
          margin-bottom: 11px;
          div {
            font-size: 18px;
            line-height: 25px;
          }
        }
        &-list {
          display: flex;
          justify-content: space-between;
          flex-wrap: wrap;
          align-items: center;
          &-item {
            flex: auto;
            //min-width: 280px;
            height: 85px;
            background: rgba(60, 88, 252, 0.02);
            border: 1px solid rgba(0, 0, 0, 0.1);
            margin-right: 20px;
            padding: 16px 20px 13px;
            display: flex;
            justify-content: flex-start;
            align-items: center;
            flex-wrap: wrap;
            cursor: pointer;
            .svg-icon {
              font-size: 56px;
              margin-right: 16px;
            }
            .txt-1,
            .txt-2 {
              font-size: 14px;
              line-height: 20px;
            }
            .txt-1 {
              margin-bottom: 8px;
            }
            .txt-2 {
              color: rgba(0, 0, 0, 0.5);
            }
            &.active {
              border-color: #3c58fc;
            }
            &:last-child {
              margin-right: 0;
            }
          }
        }
      }
      &-content {
        display: flex;
        justify-content: space-between;
        flex-wrap: wrap;
        &-left,
        &-right {
          .card {
            margin-bottom: 28px;
            .top {
              margin-bottom: 8px;
              display: flex;
              justify-content: space-between;
              flex-wrap: wrap;
              align-items: center;
              > div:last-child {
                .svg-icon {
                  font-size: 25px;
                  margin-left: 16px;
                  cursor: pointer;
                }
              }
            }
            h5 {
              font-size: 18px;
              line-height: 25px;
              margin: 0 0 8px 0;
              font-weight: normal;
            }
            &-item {
              background: rgba(60, 88, 252, 0.02);
            }
          }
        }
        &-left {
          margin-right: 20px;
          //min-width: 553px;
          max-width: 750px;
          .left-1 {
            padding: 26px 28px 10px;
            > div:first-child {
              font-size: 18px;
              line-height: 25px;
              margin-bottom: 10px;
            }
            .el-progress {
              margin-bottom: 17px;
            }
            .small-card-list {
              display: flex;
              justify-content: space-between;
              flex-wrap: wrap;
              align-items: center;
              &-item {
                background: #fff;
                margin-right: 19px;
                margin-bottom: 12px;
                flex: auto;
                min-width: 225px;
                height: 76px;
                padding: 8px 20px;
                font-size: 18px;
                line-height: 25px;
                > div:first-child {
                  margin-bottom: 7px;
                }
                &:nth-of-type(2n) {
                  margin-right: 0;
                }
              }
            }
          }
          .left-2 {
            padding: 27px 21px;
            .card-item-detail {
              background: #fff;
              padding: 11px 27px;
              .head {
                display: flex;
                justify-content: space-between;
                align-items: center;
                flex-wrap: wrap;
                margin-bottom: 9px;
                > div:first-child {
                  display: flex;
                  justify-content: flex-start;
                  flex-wrap: wrap;
                  align-items: center;
                  i {
                    width: 24px;
                    height: 24px;
                    font-size: 24px;
                    margin-right: 8px;
                  }
                  span {
                    font-size: 18px;
                    line-height: 21px;
                  }
                }
                .status {
                  font-size: 12px;
                  line-height: 17px;
                  padding: 2px 10px;
                  &.success {
                    background: rgba(88, 206, 147, 0.19);
                    color: #128f51;
                  }
                }
              }
              .info {
                display: flex;
                justify-content: space-between;
                flex-wrap: wrap;
                align-items: center;
                font-size: 18px;
                line-height: 25px;
                margin-bottom: 6px;
                > div:last-child {
                  color: rgba(0, 0, 0, 0.5);
                }
              }
              .progress {
                display: flex;
                justify-content: space-between;
                flex-wrap: wrap;
                align-items: center;
                font-size: 18px;
                line-height: 25px;
                margin-bottom: 9px;
                > div:last-child {
                  font-size: 12px;
                  color: #128f51;
                }
              }
              .el-progress {
                margin-bottom: 13px;
              }
              .desc {
                font-size: 12px;
                line-height: 17px;
                margin-bottom: 8px;
              }
            }
          }
        }
        &-right {
          flex: auto;
          //min-width: 605px;
          .card-item {
            background: rgba(60, 88, 252, 0.02);
            padding: 23px 34px;
            .list-item {
              display: flex;
              justify-content: space-between;
              flex-wrap: wrap;
              align-items: center;
              margin-bottom: 35px;
              .left {
                display: flex;
                justify-content: flex-start;
                align-items: center;
                > div:first-child {
                  color: #fff;
                  font-size: 18px;
                  line-height: 40px;
                  width: 40px;
                  height: 40px;
                  border-radius: 50%;
                  background: rgba(0, 0, 0, 0.21);
                  text-align: center;
                  margin-right: 11px;
                  &.success {
                    background: #58ce93;
                  }
                  &.warning {
                    background: #f9b280;
                  }
                }
                > div:last-child {
                  .txt-1 {
                    font-size: 16px;
                    line-height: 22px;
                    margin-bottom: 4px;
                  }
                  .txt-2 {
                    font-size: 14px;
                    line-height: 20px;
                    color: rgba(0, 0, 0, 0.5);
                  }
                }
              }
              .right {
                display: flex;
                justify-content: flex-end;
                align-items: center;
                > div {
                  margin-left: 13px;
                }
                span {
                  color: rgba(0, 0, 0, 0.5);
                  font-size: 14px;
                  line-height: 20px;
                  margin-left: 8px;
                }
              }
            }
          }
        }
      }
    }
  }
}
</style>
